VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmParametrosPlanSalud 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Parametros Plan Salud"
   ClientHeight    =   6630
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6510
   Icon            =   "frmParametrosPlanSalud.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6630
   ScaleWidth      =   6510
   Begin VB.Frame Frame3 
      BackColor       =   &H00FFFFFF&
      Height          =   2535
      Left            =   120
      TabIndex        =   19
      Top             =   3960
      Width           =   6255
      Begin VB.ListBox lstPlanCon 
         Enabled         =   0   'False
         Height          =   2010
         Left            =   3480
         Sorted          =   -1  'True
         TabIndex        =   12
         Top             =   360
         Width           =   2655
      End
      Begin VB.CommandButton cmdDelTodasCon 
         BackColor       =   &H00FFFFFF&
         Caption         =   "<<"
         Enabled         =   0   'False
         Height          =   375
         Left            =   2880
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   11
         Top             =   1920
         Width           =   495
      End
      Begin VB.CommandButton cmdAddTodasCon 
         Appearance      =   0  'Flat
         BackColor       =   &H00FFFFFF&
         Caption         =   ">>"
         Enabled         =   0   'False
         Height          =   375
         Left            =   2880
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   480
         Width           =   495
      End
      Begin VB.CommandButton cmdDelUnaCon 
         BackColor       =   &H00FFFFFF&
         Caption         =   "<"
         Enabled         =   0   'False
         Height          =   375
         Left            =   2880
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   1440
         Width           =   495
      End
      Begin VB.CommandButton cmdAddUnaCon 
         BackColor       =   &H00FFFFFF&
         Caption         =   ">"
         Enabled         =   0   'False
         Height          =   375
         Left            =   2880
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   960
         Width           =   495
      End
      Begin VB.ListBox lstTodasCon 
         Enabled         =   0   'False
         Height          =   2010
         Left            =   120
         Sorted          =   -1  'True
         TabIndex        =   7
         Top             =   360
         Width           =   2655
      End
      Begin VB.Label Label3 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Conceptos"
         Height          =   255
         Left            =   120
         TabIndex        =   21
         Top             =   120
         Width           =   1455
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Plan Salud"
         Height          =   255
         Left            =   3480
         TabIndex        =   20
         Top             =   120
         Width           =   1815
      End
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00FFFFFF&
      Height          =   2535
      Left            =   120
      TabIndex        =   16
      Top             =   1320
      Width           =   6255
      Begin VB.ListBox lstTodas 
         Enabled         =   0   'False
         Height          =   2010
         Left            =   120
         Sorted          =   -1  'True
         TabIndex        =   1
         Top             =   360
         Width           =   2655
      End
      Begin VB.CommandButton cmdAddUna 
         BackColor       =   &H00FFFFFF&
         Caption         =   ">"
         Enabled         =   0   'False
         Height          =   375
         Left            =   2880
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   960
         Width           =   495
      End
      Begin VB.CommandButton cmdDelUna 
         BackColor       =   &H00FFFFFF&
         Caption         =   "<"
         Enabled         =   0   'False
         Height          =   375
         Left            =   2880
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   1440
         Width           =   495
      End
      Begin VB.CommandButton cmdAddTodas 
         Appearance      =   0  'Flat
         BackColor       =   &H00FFFFFF&
         Caption         =   ">>"
         Enabled         =   0   'False
         Height          =   375
         Left            =   2880
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   480
         Width           =   495
      End
      Begin VB.CommandButton cmdDelTodas 
         BackColor       =   &H00FFFFFF&
         Caption         =   "<<"
         Enabled         =   0   'False
         Height          =   375
         Left            =   2880
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   1920
         Width           =   495
      End
      Begin VB.ListBox lstPlan 
         Enabled         =   0   'False
         Height          =   2010
         Left            =   3480
         Sorted          =   -1  'True
         TabIndex        =   6
         Top             =   360
         Width           =   2655
      End
      Begin VB.Label Label17 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Plan Salud"
         Height          =   255
         Left            =   3480
         TabIndex        =   18
         Top             =   120
         Width           =   1815
      End
      Begin VB.Label Label16 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Obras Sociales"
         Height          =   255
         Left            =   120
         TabIndex        =   17
         Top             =   120
         Width           =   1455
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFFF&
      Height          =   975
      Left            =   120
      TabIndex        =   14
      Top             =   360
      Width           =   6255
      Begin VB.TextBox txtDia 
         Appearance      =   0  'Flat
         Height          =   315
         Left            =   120
         MaxLength       =   2
         TabIndex        =   0
         Top             =   480
         Width           =   615
      End
      Begin VB.Label Label1 
         BackColor       =   &H00FFFFFF&
         Caption         =   "Dia cierre validez cobertura (0 inactivo):"
         Height          =   255
         Left            =   120
         TabIndex        =   15
         Top             =   240
         Width           =   3015
      End
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   2280
      Top             =   0
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   11
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":08CA
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":0E64
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":13FE
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":1998
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":1F32
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":24CC
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":2A66
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":3000
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":359A
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":3B34
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmParametrosPlanSalud.frx":40CE
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   360
      Left            =   0
      TabIndex        =   13
      Top             =   0
      Width           =   6510
      _ExtentX        =   11483
      _ExtentY        =   635
      ButtonWidth     =   609
      ButtonHeight    =   582
      Appearance      =   1
      Style           =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   5
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Aceptar"
            Object.ToolTipText     =   "Aceptar (F5)"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Salir"
            Object.ToolTipText     =   "Salir (Esc)"
            ImageIndex      =   11
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
      EndProperty
      BorderStyle     =   1
   End
End
Attribute VB_Name = "frmParametrosPlanSalud"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim con As New ConBaseDatos, i As Integer

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
    Case 27 'Escape "Salir"
        If Toolbar1.Buttons(4).Enabled Then Toolbar1_ButtonClick Toolbar1.Buttons(4)
        
    Case 112 'F1 "Ayuta"
        frmPrincipal.manual_Click
            
    Case 116 'F5 "Aceptar"
        If Toolbar1.Buttons(2).Enabled Then Toolbar1_ButtonClick Toolbar1.Buttons(2)
        
End Select

End Sub

Private Sub Form_Load()

Dim datos() As String, dato() As String, cPlan As String
Dim datos2() As String, cCon As String

Abrir Me

con.AbrirRegistros "select * from parametros where parametro='0000000001'", Consulta
If Not con.Registros.EOF Then
    datos = Split(con.Registros("datos"), "<||>")
    
    dato = Split(datos(0), ":")
    txtDia.Text = dato(1)
    
    dato = Split(datos(1), ":")
    datos2 = Split(dato(1), "{||}")
    For i = 0 To UBound(datos2) - 1
        cPlan = cPlan & "'" & datos2(i) & "',"
        DoEvents
    Next i
    
    On Error Resume Next
    dato = Split(datos(3), ":")
    datos2 = Split(dato(1), "{||}")
    For i = 0 To UBound(datos2) - 1
        cCon = cCon & "'" & datos2(i) & "',"
        DoEvents
    Next i
    On Error GoTo 0
End If
con.CerrarRegistros
If Len(cPlan) > 0 Then
    cPlan = Left(cPlan, Len(cPlan) - 1)
Else
    cPlan = "''"
End If
If Len(cCon) > 0 Then
    cCon = Left(cCon, Len(cCon) - 1)
Else
    cCon = "''"
End If


'obras sociales
lstTodas.Clear
con.AbrirRegistros "SELECT obra_social, nombre FROM obras_sociales where obra_social not in(" & cPlan & ") order by nombre", Consulta
Do While Not con.Registros.EOF
    lstTodas.AddItem DesEditar(con.Registros("nombre"))
    lstTodas.ItemData(lstTodas.NewIndex) = CInt(con.Registros("obra_social"))
    con.Registros.MoveNext
    DoEvents
Loop
con.CerrarRegistros
If lstTodas.ListCount > 0 Then
    cmdAddTodas.Enabled = True
    cmdAddUna.Enabled = True
    lstTodas.Enabled = True
End If

'obras sociales plan salud
lstPlan.Clear
con.AbrirRegistros "SELECT obra_social, nombre FROM obras_sociales where obra_social in(" & cPlan & ") order by nombre", Consulta
Do While Not con.Registros.EOF
    lstPlan.AddItem DesEditar(con.Registros("nombre"))
    lstPlan.ItemData(lstPlan.NewIndex) = CInt(con.Registros("obra_social"))
    con.Registros.MoveNext
    DoEvents
Loop
con.CerrarRegistros
If lstPlan.ListCount > 0 Then
    cmdDelTodas.Enabled = True
    cmdDelUna.Enabled = True
    lstPlan.Enabled = True
End If

'Conceptos
lstTodasCon.Clear
con.AbrirRegistros "select concepto,codigo+'-'+nombre as nom from conceptos where tipo='ingreso' and concepto not in(" & cCon & ") order by nombre", Consulta
Do While Not con.Registros.EOF
    lstTodasCon.AddItem DesEditar(con.Registros("nom"))
    lstTodasCon.ItemData(lstTodasCon.NewIndex) = CInt(con.Registros("concepto"))
    con.Registros.MoveNext
    DoEvents
Loop
con.CerrarRegistros
If lstTodasCon.ListCount > 0 Then
    cmdAddTodasCon.Enabled = True
    cmdAddUnaCon.Enabled = True
    lstTodasCon.Enabled = True
End If

'conceptos plan salud
lstPlanCon.Clear
con.AbrirRegistros "select concepto,codigo+'-'+nombre as nom from conceptos where tipo='ingreso' and concepto in(" & cCon & ") order by nombre", Consulta
Do While Not con.Registros.EOF
    lstPlanCon.AddItem DesEditar(con.Registros("nom"))
    lstPlanCon.ItemData(lstPlanCon.NewIndex) = CInt(con.Registros("concepto"))
    con.Registros.MoveNext
    DoEvents
Loop
con.CerrarRegistros
If lstPlanCon.ListCount > 0 Then
    cmdDelTodasCon.Enabled = True
    cmdDelUnaCon.Enabled = True
    lstPlanCon.Enabled = True
End If

End Sub

Private Sub Form_Unload(Cancel As Integer)

If Not Toolbar1.Buttons(4).Enabled Then Cancel = True

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key
         
    Case "Salir"
        Unload Me
    
    Case "Aceptar"
        If Control Then Exit Sub
        Grabar
        Unload Me
        
End Select

End Sub

Private Sub txtDia_GotFocus()

txtDia.SelStart = 0
txtDia.SelLength = Len(txtDia.Text)
txtDia.BackColor = &HFFFFC0

End Sub

Private Sub txtDia_KeyPress(KeyAscii As Integer)

Select Case KeyAscii
    Case 48 To 57, 8
    
    Case 13
        SendKeys "{TAB}"
        KeyAscii = 0
    
    Case Else
        KeyAscii = 0
End Select

End Sub

Private Sub txtDia_LostFocus()

txtDia.BackColor = &H80000005

End Sub
Private Function Control() As Boolean

Dim encontre As Boolean

Control = False

If txtDia.Text = "" Then txtDia.Text = 0
If txtDia.Text < 0 Or txtDia.Text > 31 Then
    Control = True
    MsgBox "Dia no valido, debe estar entre 0 y 31", vbCritical, "Error datos"
    txtDia.SetFocus
    
Else 'control que las obras sociales que se borren no tengan grupos familiares
    con.AbrirRegistros "select distinct obra_social_1 as plan_salud from grupos_familiares where obra_social_1<>'' union select distinct obra_social_2 as plan_salud from grupos_familiares where obra_social_2<>''", Consulta
    Do While Not con.Registros.EOF
        encontre = False
        For i = 0 To lstPlan.ListCount - 1
            lstPlan.ListIndex = i
            If con.Registros(0) = ReplicarCaracter("0", LargoID, lstPlan.ItemData(lstPlan.ListIndex)) Then
                encontre = True
                Exit For
            End If
            DoEvents
        Next i
        If Not encontre Then
            Control = True
            MsgBox "La obra social: " & DesEditar(con.BusDato("obras_sociales", "nombre", "obra_social='" & con.Registros(0) & "'")) & vbCrLf & "Tiene grupos familiares, debe estar en plan salud", vbCritical, "Error datos"
            Exit Do
        End If
        con.Registros.MoveNext
        DoEvents
    Loop
    con.CerrarRegistros
End If

End Function

Private Sub Grabar()

Dim datos As String, dato As String, dato2 As String

'obras sociales
For i = 0 To lstPlan.ListCount - 1
    lstPlan.ListIndex = i
    dato = dato & ReplicarCaracter("0", LargoID, lstPlan.ItemData(lstPlan.ListIndex)) & "{||}"
    DoEvents
Next i

'conceptos
For i = 0 To lstPlanCon.ListCount - 1
    lstPlanCon.ListIndex = i
    dato2 = dato2 & ReplicarCaracter("0", LargoID, lstPlanCon.ItemData(lstPlanCon.ListIndex)) & "{||}"
    DoEvents
Next i

datos = "dia:" & txtDia.Text & "<||>" & _
        "obras_sociales_plan_salud:" & dato & "<||>" & _
        "mes_efectuado_control:00" & "<||>" & _
        "conceptos_plan_salud:" & dato2 & "<||>"

If con.ExisteDatos("parametros", "parametro='0000000001'") Then
    con.ActualizarRegistros "parametros", "descripcion,datos", "'Parametros Plan Salud','" & datos & "'", "parametro='0000000001'"
Else
    con.InsertarRegistros "parametros", "parametro,descripcion,datos", "'0000000001','Parametros Plan Salud','" & datos & "'"
End If

End Sub

Private Sub lstPlan_GotFocus()

lstPlan.BackColor = &HFFFFC0

End Sub

Private Sub lstPlan_LostFocus()

lstPlan.BackColor = &H80000005

End Sub

Private Sub lstTodas_GotFocus()

lstTodas.BackColor = &HFFFFC0

End Sub

Private Sub lstTodas_LostFocus()

lstTodas.BackColor = &H80000005

End Sub

Private Sub lstPlan_DblClick()

cmdDelUna_Click

End Sub

Private Sub lstTodas_DblClick()

cmdAddUna_Click

End Sub

Private Sub cmdAddTodas_Click()
'agrega todas

For i = 0 To lstTodas.ListCount - 1
    lstTodas.ListIndex = i
    lstPlan.AddItem lstTodas.Text
    lstPlan.ItemData(lstPlan.NewIndex) = lstTodas.ItemData(lstTodas.ListIndex)
    DoEvents
Next i
lstTodas.Clear
lstTodas.Enabled = False
lstPlan.Enabled = True
cmdAddTodas.Enabled = False
cmdAddUna.Enabled = False
cmdDelTodas.Enabled = True
cmdDelUna.Enabled = True

End Sub

Private Sub cmdAddUna_Click()
'agrega una

If lstTodas.ListIndex = -1 Then
    MsgBox "Seleccione obra social", vbCritical, "Error seleccion de datos"
    lstTodas.SetFocus
    Exit Sub
End If

lstPlan.AddItem lstTodas.Text
lstPlan.ItemData(lstPlan.NewIndex) = lstTodas.ItemData(lstTodas.ListIndex)
lstTodas.RemoveItem lstTodas.ListIndex

lstPlan.Enabled = True
cmdDelTodas.Enabled = True
cmdDelUna.Enabled = True

If lstTodas.ListCount = 0 Then
    lstTodas.Enabled = False
    cmdAddTodas.Enabled = False
    cmdAddUna.Enabled = False
End If

End Sub

Private Sub cmdDelTodas_Click()
'quita todas

For i = 0 To lstPlan.ListCount - 1
    lstPlan.ListIndex = i
    lstTodas.AddItem lstPlan.Text
    lstTodas.ItemData(lstTodas.NewIndex) = lstPlan.ItemData(lstPlan.ListIndex)
    DoEvents
Next i
lstPlan.Clear
lstPlan.Enabled = False
lstTodas.Enabled = True
cmdDelTodas.Enabled = False
cmdDelUna.Enabled = False
cmdAddTodas.Enabled = True
cmdAddUna.Enabled = True

End Sub

Private Sub cmdDelUna_Click()
'quita una

If lstPlan.ListIndex = -1 Then
    MsgBox "Seleccione obra social", vbCritical, "Error seleccion de datos"
    lstPlan.SetFocus
    Exit Sub
End If

lstTodas.AddItem lstPlan.Text
lstTodas.ItemData(lstTodas.NewIndex) = lstPlan.ItemData(lstPlan.ListIndex)
lstPlan.RemoveItem lstPlan.ListIndex

lstTodas.Enabled = True
cmdAddTodas.Enabled = True
cmdAddUna.Enabled = True

If lstPlan.ListCount = 0 Then
    lstPlan.Enabled = False
    cmdDelTodas.Enabled = False
    cmdDelUna.Enabled = False
End If

End Sub

Private Sub lstPlanCon_GotFocus()

lstPlanCon.BackColor = &HFFFFC0

End Sub

Private Sub lstPlanCon_LostFocus()

lstPlanCon.BackColor = &H80000005

End Sub

Private Sub lstTodasCon_GotFocus()

lstTodasCon.BackColor = &HFFFFC0

End Sub

Private Sub lstTodasCon_LostFocus()

lstTodasCon.BackColor = &H80000005

End Sub

Private Sub lstPlanCon_DblClick()

cmdDelUnaCon_Click

End Sub

Private Sub lstTodasCon_DblClick()

cmdAddUnaCon_Click

End Sub

Private Sub cmdAddTodasCon_Click()
'agrega todas

For i = 0 To lstTodasCon.ListCount - 1
    lstTodasCon.ListIndex = i
    lstPlanCon.AddItem lstTodasCon.Text
    lstPlanCon.ItemData(lstPlanCon.NewIndex) = lstTodasCon.ItemData(lstTodasCon.ListIndex)
    DoEvents
Next i
lstTodasCon.Clear
lstTodasCon.Enabled = False
lstPlanCon.Enabled = True
cmdAddTodasCon.Enabled = False
cmdAddUnaCon.Enabled = False
cmdDelTodasCon.Enabled = True
cmdDelUnaCon.Enabled = True

End Sub

Private Sub cmdAddUnaCon_Click()
'agrega una

If lstTodasCon.ListIndex = -1 Then
    MsgBox "Seleccione concepto", vbCritical, "Error seleccion de datos"
    lstTodasCon.SetFocus
    Exit Sub
End If

lstPlanCon.AddItem lstTodasCon.Text
lstPlanCon.ItemData(lstPlanCon.NewIndex) = lstTodasCon.ItemData(lstTodasCon.ListIndex)
lstTodasCon.RemoveItem lstTodasCon.ListIndex

lstPlanCon.Enabled = True
cmdDelTodasCon.Enabled = True
cmdDelUnaCon.Enabled = True

If lstTodasCon.ListCount = 0 Then
    lstTodasCon.Enabled = False
    cmdAddTodasCon.Enabled = False
    cmdAddUnaCon.Enabled = False
End If

End Sub

Private Sub cmdDelTodasCon_Click()
'quita todas

For i = 0 To lstPlanCon.ListCount - 1
    lstPlanCon.ListIndex = i
    lstTodasCon.AddItem lstPlanCon.Text
    lstTodasCon.ItemData(lstTodasCon.NewIndex) = lstPlanCon.ItemData(lstPlanCon.ListIndex)
    DoEvents
Next i
lstPlanCon.Clear
lstPlanCon.Enabled = False
lstTodasCon.Enabled = True
cmdDelTodasCon.Enabled = False
cmdDelUnaCon.Enabled = False
cmdAddTodasCon.Enabled = True
cmdAddUnaCon.Enabled = True

End Sub

Private Sub cmdDelUnaCon_Click()
'quita una

If lstPlanCon.ListIndex = -1 Then
    MsgBox "Seleccione concepto", vbCritical, "Error seleccion de datos"
    lstPlanCon.SetFocus
    Exit Sub
End If

lstTodasCon.AddItem lstPlanCon.Text
lstTodasCon.ItemData(lstTodasCon.NewIndex) = lstPlanCon.ItemData(lstPlanCon.ListIndex)
lstPlanCon.RemoveItem lstPlanCon.ListIndex

lstTodasCon.Enabled = True
cmdAddTodasCon.Enabled = True
cmdAddUnaCon.Enabled = True

If lstPlanCon.ListCount = 0 Then
    lstPlanCon.Enabled = False
    cmdDelTodasCon.Enabled = False
    cmdDelUnaCon.Enabled = False
End If

End Sub
